<template>
  <div id="bingtu" class="bingtu" />
</template>

<script>
const echarts = require('echarts/lib/echarts')
require('echarts/lib/component/tooltip')
require('echarts/lib/component/legend')
require('echarts/lib/chart/pie')
export default {
  mounted() {
    var chartDom = document.getElementById('bingtu')
    var myChart = echarts.init(chartDom)
    var option

    option = {
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '5%',
        left: 'center'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: ['40%', '70%'],
          avoidLabelOverlap: false,
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '40',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            { value: 1048, name: '公寓' },
            { value: 735, name: '别墅' },
            { value: 580, name: '商铺' }
          ]
        }
      ]
    }

    option && myChart.setOption(option)
  }
}
</script>

<style scoped>
.bingtu{
    /* display: inline-block; */
    width: 430px;
    height: 300px;
}
</style>
